package com.zir.face.controller;


import com.zir.face.service.FaceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

//把将来返回的数据打包好
@RestController
//前端请求这个路径
@RequestMapping("/face")
//解决跨域问题
@CrossOrigin(origins = "*")
public class FaceController {

    @Autowired
    FaceServiceImpl faceService;


    /**
     *
     * @param file  前端传给后端的照片
     * @param style  前端传给后端的风格参数
     * @return
     */


    @PostMapping("/generateHumanAnimeStyle")
    public String generateHumanAnimeStyle(@RequestBody MultipartFile file,
                                          @RequestParam String style) throws Exception {
        //调⽤FaceServiceImpl中的generateHumanAnimeStyle⽅法完成业务处理
        return faceService.generateHumanAnimeStyle(file,style);
    }


}
